﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Windows.Forms;

namespace Oraycn.RecordDemo
{
  /*
  * 本demo采用的是 语音视频采集组件MCapture 的免费版本。若想获取MCapture其它版本，请联系 www.oraycn.com 。
  *
  */

  static class Program
  {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    public static void Main()
    {
      Screen();
      //var mainProcesse = MainProcesse("chrome");
    }

    private static void Screen()
    {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Application.Run(new Form1("d://test.ts", "http://localhost/m3u/upload"));
    }

    //获取应用程序进程
    private static Process MainProcesse(string name)
    {
      var processes = Process.GetProcesses(System.Environment.MachineName);
      Debug.WriteLine(@"test:" + processes.Length);
      var chormes = new List<Process>();
      foreach (
        Process p in Process.GetProcesses(System.Environment.MachineName))
      {
        if (p.MainWindowHandle != IntPtr.Zero && p.ProcessName.ToLower().Equals(name))
        {
          return p;
        }
      }
      return null;
    }
  }
}